package com.example.learn.service;

import com.example.learn.domain.Topleftmethod;
import com.example.learn.entity.Income;
import com.example.learn.entity.User;
import com.example.learn.mapper.IncomeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MyechartService {
    @Resource
    IncomeMapper incomeMapper;
    public Topleftmethod topleftmethod(User user) {
        Topleftmethod topleftmethod=new Topleftmethod();
        //先查询时间
        List<Income> listTime= incomeMapper.getIncomeTime();
        List<Income> listTime2= incomeMapper.getIncomeTimeByName(user.getName());
        for (Income income:listTime) {
            topleftmethod.getListTime().add(income.getDate());
            topleftmethod.getListFamily().add(income.getMoney());
        }
        for (Income income:listTime2
             ) {
            topleftmethod.getListPersonage().add(income.getMoney());
        }
        return topleftmethod;

    }
}
